<template>

</template>

<script>

  export default {
    created() {
     this.confirmClick()
    },
    methods: {
      confirmClick() {
        this.$confirm("是否退出系统?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        })
          .then(() => {
            this.logout()
          })
          .catch(() => {
            this.$router.replace({path: '/dashboard'});
          });
      },
      async logout() {
        await this.$store.dispatch('user/logout')
        // this.$router.push(`/login?redirect=${this.$route.fullPath}`)
        this.$router.replace({path: '/login'});

      }
    }
  };
</script>
